

-- ----------------------------
-- Table structure for t_channel
-- ----------------------------
DROP TABLE IF EXISTS `t_channel`;
CREATE TABLE `t_channel` (
  `id` bigint(22) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  `main_domain_name` varchar(128) NOT NULL COMMENT '主域名',
  `main_domain_provider` varchar(128) NOT NULL COMMENT '主域名提供商',
  `backup_domain_id` int(11) DEFAULT NULL COMMENT '备份域名',
  `backup_domain_name` varchar(128) DEFAULT NULL COMMENT '备份域名',
  `backup_domain_provider` varchar(128) DEFAULT NULL COMMENT '备份域名提供商',
  `creator` varchar(45) DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `modifier` varchar(45) DEFAULT NULL COMMENT '修改人',
  `modify_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除字段',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='短链接通道配置表';

-- ----------------------------
-- Records of t_channel
-- ----------------------------
BEGIN;
INSERT INTO `t_channel` VALUES (1, 'http://s.oky8.cn/', 'XP', NULL, NULL, NULL, 'admin', '2022-12-23 14:55:14', 'admin', '2023-01-02 14:17:18', 0);
COMMIT;

-- ----------------------------
-- Table structure for t_max_uuid
-- ----------------------------
DROP TABLE IF EXISTS `t_max_uuid`;
CREATE TABLE `t_max_uuid` (
  `id` bigint(22) unsigned NOT NULL COMMENT '主键',
  `uuid` bigint(22) NOT NULL COMMENT '当前最大的uuid十进制的值',
  `create_time` datetime NOT NULL COMMENT '转换时间',
  `modify_time` datetime NOT NULL COMMENT '过期时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='当前最大的uuid';

-- ----------------------------
-- Records of t_max_uuid
-- ----------------------------
BEGIN;
INSERT INTO `t_max_uuid` VALUES (1, 9, '2022-12-23 21:41:55', '2022-12-23 21:41:55');
COMMIT;

-- ----------------------------
-- Table structure for t_short_url_map
-- ----------------------------
DROP TABLE IF EXISTS `t_short_url_map`;
CREATE TABLE `t_short_url_map` (
  `id` bigint(20) unsigned NOT NULL COMMENT '主键',
  `business_line` char(1) NOT NULL COMMENT '产品线',
  `uuid` bigint(22) NOT NULL COMMENT '十进制的值',
  `short_url` varchar(64) NOT NULL COMMENT '短链接url',
  `long_url` text COMMENT '要转换的短链接',
  `create_time` datetime NOT NULL COMMENT '转换时间',
  `expire_time` datetime NOT NULL COMMENT '过期时间',
  `modify_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `access_count` int(11) NOT NULL DEFAULT '0' COMMENT '访问次数',
  PRIMARY KEY (`id`),
  KEY `idx_uuid` (`uuid`),
  KEY `idx_short_url` (`short_url`),
  KEY `idx_expire_time` (`expire_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='短链接映射表';


-- ----------------------------
-- Table structure for t_short_url_register
-- ----------------------------
DROP TABLE IF EXISTS `t_short_url_register`;
CREATE TABLE `t_short_url_register` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  `business_line` char(1) NOT NULL COMMENT '业务线',
  `module` varchar(64) NOT NULL COMMENT '模块名称',
  `app_key` varchar(64) NOT NULL COMMENT 'app key',
  `locked` tinyint(4) DEFAULT '0' COMMENT '是否被锁定',
  `creator` varchar(45) DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `modifier` varchar(45) DEFAULT NULL COMMENT '修改人',
  `modify_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除字段',
  `hystrix` tinyint(4) NOT NULL DEFAULT '0' COMMENT '熔断开关',
  `threshold` int(11) NOT NULL DEFAULT '0' COMMENT '熔断阈值',
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQ_MODULE` (`module`),
  UNIQUE KEY `UNIQ_APP_KEY` (`app_key`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='短链接应用注册表';

-- ----------------------------
-- Records of t_short_url_register
-- ----------------------------
BEGIN;
INSERT INTO `t_short_url_register` VALUES (1, '0', 'demo', '2abafaed29', 0, 'admin', '2022-12-23 20:41:49', 'admin', '2022-12-24 09:12:21', 0, 0, 0);
COMMIT;

-- ----------------------------
-- Table structure for t_short_url_statistics
-- ----------------------------
DROP TABLE IF EXISTS `t_short_url_statistics`;
CREATE TABLE `t_short_url_statistics` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  `app_key` varchar(64) NOT NULL COMMENT 'app key',
  `statistics_time` datetime NOT NULL COMMENT '统计时间',
  `total` int(11) NOT NULL COMMENT '统计时间内调用次数',
  `succeed` int(11) NOT NULL COMMENT '统计时间内转换成功数',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `modify_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  KEY `idx_app_key` (`app_key`),
  KEY `idx_statistics_time` (`statistics_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='短链接调用统计表';

SET FOREIGN_KEY_CHECKS = 1;
